var linkTargetFinder = function () {
	var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
	return {
		init : function () {
			gBrowser.addEventListener("load", function () {
				var autoRun = prefManager.getBoolPref("extensions.linktargetfinder.autorun");
				if (autoRun) {
					linkTargetFinder.run();
				}
			}, false);
		},
			
		run : function () {
   		var foundISBN = 0,
				 //findMe = /^(?:ISBN(?:-1[03])?:? )?(?=[-0-9 ]{17}$|[-0-9X ]{13}$|[0-9X]{10}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?(?:[0-9]+[- ]?){2}[0-9X]$/,
				 findMe=/\d{10}/,
             pageCont=window.content.document.body.innerHTML,
				 results = pageCont.match(findMe);
		   
			for (var i=0; i<results.length; i++) {
   			alert(results[i]);
			}
//			if (foundLinks === 0) {
//				alert("No links found with a target attribute");
//			}
//			else {
//				alert("Found " + foundLinks + " links with a target attribute");
//			}	
		}
	};
}();
window.addEventListener("load", linkTargetFinder.init, false);